<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/JSP/Common/head.jsp"%>
<div class="nowPosition">你所在的位置是用户管理</div>
<div class="user-div">
    <form action="${pageContext.request.contextPath }/JSP/user.go" method="get" style="float: left;">
        <input name="method" value="getUserList" class="input-text" type="hidden">
        用户名：<input type="text" class="txtclick user-input-text inshadow" id="queryUserName" name="queryUserName" value="" />
        用户角色：
        <select name="queryUserRole" class="user-select inshadow">
            <c:if test="${roleList != null }">
                <option value="0">--请选择--</option>
                <c:forEach var="role" items="${roleList}">
                    <option <c:if test="${role.id == queryUserRole }">selected="selected"</c:if>
                            value="${role.id}">${role.roleName}</option>
                </c:forEach>
            </c:if>
        </select>
        <input type="hidden" id="pageIndex" name="pageIndex"/>
        <input class="user-submit inshadow-white btnclick" type="submit" value="查询"/>
    </form>
    <a class="btnclick user-a inshadow-white float-left" href="${pageContext.request.contextPath}/JSP/userAdd.jsp"><img src="../../SVG/addUserNofill.svg"/>&nbsp;&nbsp;添加用户</a>
</div>

<table class="user-table" cellspacing="0" cellpadding="0">
    <tr bgcolor="#87CEEB">
        <th width="15%">用户账号</th>
        <th width="15%">用户姓名</th>
        <th width="10%">性别</th>
        <th width="10%">年龄</th>
        <th width="15%">电话</th>
        <th width="15%">用户职位</th>
        <th width="20%">操作</th>
    </tr>
    <c:forEach var="user" items="${userList }" varStatus="status">
        <tr>
            <td>
                <span>${user.userCode }</span>
            </td>
            <td>
                <span>${user.userName }</span>
            </td>
            <td>
                <span>${user.gender}</span>
            </td>
            <td>
                <span>${user.age}</span>
            </td>
            <td>
                <span>${user.phone}</span>
            </td>
            <td>
                <span>${user.userRoleName}</span>
            </td>
            <td>
                <span><a class="userInformation" href="javascript:;" userId=${user.id } userName=${user.userName }><img src="${pageContext.request.contextPath }/SVG/selectUser.svg" title="查看" alt="查看" /></a></span>
                <c:if test="${nowUserRole <= user.userRole}">
                    <span><a class="updateUser" href="javascript:;" userId=${user.id } userName=${user.userName }><img src="${pageContext.request.contextPath }/SVG/updateUser.svg" title="修改" alt="修改" /></a></span>
                    <c:if test="${nowUserRole < user.userRole || nowUserRole == 1}">
                        <span><a class="deleteUser" href="javascript:;" userId=${user.id } userName=${user.userName }><img src="${pageContext.request.contextPath }/SVG/delUser.svg" title="删除" alt="删除" /></a></span>
                    </c:if>
                </c:if>
            </td>
        </tr>
    </c:forEach>
</table>
<input type="hidden" id="pageCount" value="${pageCount}"/>
<%@ include file="/JSP/Common/paging.jsp"%>
<%@ include file="/JSP/Common/foot.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath}/JS/userList.js" ></script>
